const {find} = require('../model/users')

const list = (req, res, next) => {
  // 获取get请求的数据
  let query = req.query
  res.json(query)
}

const signin = async (req, res, next) => {
  res.set('content-type', 'application/json; charset=utf8')

  let result = await find()

  // 获取post请求的数据
  // let query = req.body

  // view中间间提供的方法
  // SSR: server side renderer
  res.render('user', {
    data: JSON.stringify(result)
  })
}

module.exports = {
  list,
  signin
}